
$(function() {
	var validator = $("#form_add").validate({
		rules: {
			title: "required"
		},
		messages: {
			status: {
				required: "请选择一个状态"
			}
		},
		errorPlacement: function(label, element) {
			label.insertAfter(element);
		},
		success: function(label) {
			label.html("&nbsp;").addClass("checked");
		}
	});

	$("#userfile").uploadify({
		'uploader'       : '/js/uploadify.swf',
		'cancelImg'      : '/images/uploadify/cancel.png',
		'buttonImg'      : '/images/uploadify/browse-files.png',
		'width'          : 130,
		'queueSizeLimit' : 10,
		'multi'          : true, 
		'fileExt'		 : '*.jpg',
		
		'onSelectOnce'  : function(event, data) {
			if (data.fileCount > 0) {
				$("#_upload").val("2");
			}			
		},

		'onQueueFull'  : function(event, queueSizeLimit) {
		},

		'onCancel'  : function(event, queueId, fileObj, data) {
			if (data.fileCount == 0) {
				$("#_upload").val("1");
			}
		},
		
		'onComplete'  : function(event, queueId, fileObj, response, data) {
		}, 

		'onAllComplete'  : function(event, data) {
			$("#dialog_add").dialog("close");
		}
	});

	$('textarea').css("width", 400);

	var options = {
		zoomWidth: 300,
		zoomHeight: 240
	}
    
	$("a[id^='zoom_']").jqzoom();
});